home *** CD-ROM | disk | FTP | other *** search
/ BMUG Revelations / BMUG Revelations.toast / Programming / Programming Languages / Harvest C / MPW Int & Lib / Interfaces / Printing.h < prev    next >
Text File  |  1991-04-17  |  10KB  |  329 lines

  1. /************************************************************
  2.  
  3. Created: Sunday, January 6, 1991 at 9:40 PM
  4.     Printing.h
  5.     C Interface to the Macintosh Libraries
  6.  
  7.  
  8.         Copyright Apple Computer, Inc.    1985-1989
  9.         All rights reserved
  10.  
  11. ************************************************************/
  12.  
  13.  
  14. #ifndef __PRINTING__
  15. #define __PRINTING__
  16.  
  17. #ifndef __QUICKDRAW__
  18. #include <Quickdraw.h>
  19. #endif
  20.  
  21. #ifndef __DIALOGS__
  22. #include <Dialogs.h>
  23. #endif
  24.  
  25.  
  26. enum {
  27.  
  28.     iPFMaxPgs = 128,
  29.     iPrPgFract = 120,               /*Page scale factor. ptPgSize (below) is in units of 1/iPrPgFract*/
  30.     iPrPgFst = 1,                   /*Page range constants*/
  31.     iPrPgMax = 9999,
  32.     iPrRelease = 3,                 /*Current version number of the code.*/
  33.     iPrSavPFil = -1,
  34.     iPrAbort = 0x0080,
  35.     iPrDevCtl = 7,                  /*The PrDevCtl Proc's ctl number*/
  36.     lPrReset = 0x00010000,          /*The PrDevCtl Proc's CParam for reset*/
  37.     lPrLineFeed = 0x00030000,
  38.     lPrLFStd = 0x0003FFFF,          /*The PrDevCtl Proc's CParam for std paper advance*/
  39.     lPrLFSixth = 0x0003FFFF,
  40.     lPrPageEnd = 0x00020000,        /*The PrDevCtl Proc's CParam for end page*/
  41.     lPrDocOpen = 0x00010000,
  42.     lPrPageOpen = 0x00040000,
  43.     lPrPageClose = 0x00020000,
  44.     lPrDocClose = 0x00050000,
  45.     iFMgrCtl = 8,                   /*The FMgr's Tail-hook Proc's ctl number*/
  46.     iMemFullErr = -108,
  47.     iIOAbort = -27
  48. };
  49. enum {
  50.     pPrGlobals = 0x00000944,        /*The PrVars lo mem area:*/
  51.     bDraftLoop = 0,
  52.     bSpoolLoop = 1,
  53.     bUser1Loop = 2,
  54.     bUser2Loop = 3,
  55.     iPrBitsCtl = 4,
  56.     lScreenBits = 0,
  57.     lPaintBits = 1,
  58.     lHiScreenBits = 0x00000002,     /*The Bitmap Print Proc's Screen Bitmap param*/
  59.     lHiPaintBits = 0x00000003,      /*The Bitmap Print Proc's Paint [sq pix] param*/
  60.     iPrIOCtl = 5,
  61.     iPrEvtCtl = 6,                  /*The PrEvent Proc's ctl number*/
  62.     lPrEvtAll = 0x0002FFFD,         /*The PrEvent Proc's CParam for the entire screen*/
  63.     lPrEvtTop = 0x0001FFFD,         /*The PrEvent Proc's CParam for the top folder*/
  64.  
  65. #define sPrDrvr ".Print"
  66.  
  67.     iPrDrvrRef = -3,
  68.     getRslDataOp = 4,
  69.     setRslOp = 5,
  70.     draftBitsOp = 6,
  71.     noDraftBitsOp = 7,
  72.     getRotnOp = 8
  73. };
  74. enum {
  75.     NoSuchRsl = 1,
  76.     RgType1 = 1
  77. };
  78.  
  79. enum {feedCut,feedFanfold,feedMechCut,feedOther};
  80. typedef unsigned char TFeed;
  81.  
  82. enum {scanTB,scanBT,scanLR,scanRL};
  83. typedef unsigned char TScan;
  84.  
  85.  
  86. typedef Rect *TPRect;
  87. typedef pascal void (*PrIdleProcPtr)(void);
  88. typedef pascal void (*PItemProcPtr)(DialogPtr theDialog, short item);
  89.  
  90. struct TPrPort {
  91.     GrafPort gPort;                 /*The Printer's graf port.*/
  92.     QDProcs gProcs;                 /*..and its procs*/
  93.     long lGParam1;                  /*16 bytes for private parameter storage.*/
  94.     long lGParam2;
  95.     long lGParam3;
  96.     long lGParam4;
  97.     Boolean fOurPtr;                /*Whether the PrPort allocation was done by us.*/
  98.     Boolean fOurBits;               /*Whether the BitMap allocation was done by us.*/
  99. };
  100.  
  101. typedef struct TPrPort TPrPort;
  102. typedef TPrPort *TPPrPort;
  103.  
  104. /* Printing Graf Port. All printer imaging, whether spooling, banding, etc, happens "thru" a GrafPort.
  105.   This is the "PrPeek" record. */
  106. struct TPrInfo {
  107.     short iDev;                     /*Font mgr/QuickDraw device code*/
  108.     short iVRes;                    /*Resolution of device, in device coordinates*/
  109.     short iHRes;                    /*..note: V before H => compatable with Point.*/
  110.     Rect rPage;                     /*The page (printable) rectangle in device coordinates.*/
  111. };
  112.  
  113. typedef struct TPrInfo TPrInfo;
  114. typedef TPrInfo *TPPrInfo;
  115.  
  116. /* Print Info Record: The parameters needed for page composition. */
  117. struct TPrStl {
  118.     short wDev;
  119.     short iPageV;
  120.     short iPageH;
  121.     char bPort;
  122.     TFeed feed;
  123. };
  124.  
  125. typedef struct TPrStl TPrStl;
  126. typedef TPrStl *TPPrStl;
  127.  
  128. struct TPrXInfo {
  129.     short iRowBytes;
  130.     short iBandV;
  131.     short iBandH;
  132.     short iDevBytes;
  133.     short iBands;
  134.     char bPatScale;
  135.     char bUlThick;
  136.     char bUlOffset;
  137.     char bUlShadow;
  138.     TScan scan;
  139.     char bXInfoX;
  140. };
  141.  
  142. typedef struct TPrXInfo TPrXInfo;
  143. typedef TPrXInfo *TPPrXInfo;
  144.  
  145. struct TPrJob {
  146.     short iFstPage;                 /*Page Range.*/
  147.     short iLstPage;
  148.     short iCopies;                  /*No. copies.*/
  149.     char bJDocLoop;                 /*The Doc style: Draft, Spool, .., and ..*/
  150.     Boolean fFromUsr;               /*Printing from an User's App (not PrApp) flag*/
  151.     PrIdleProcPtr pIdleProc;        /*The Proc called while waiting on IO etc.*/
  152.     StringPtr pFileName;            /*Spool File Name: NIL for default.*/
  153.     short iFileVol;                 /*Spool File vol, set to 0 initially*/
  154.     char bFileVers;                 /*Spool File version, set to 0 initially*/
  155.     char bJobX;                     /*An eXtra byte.*/
  156. };
  157.  
  158. typedef struct TPrJob TPrJob;
  159. typedef TPrJob *TPPrJob;
  160.  
  161. /* Print Job: Print "form" for a single print request. */
  162. struct TPrint {
  163.     short iPrVersion;               /*(2) Printing software version*/
  164.     TPrInfo prInfo;                 /*(14) the PrInfo data associated with the current style.*/
  165.     Rect rPaper;                    /*(8) The paper rectangle [offset from rPage]*/
  166.     TPrStl prStl;                   /*(8)  This print request's style.*/
  167.     TPrInfo prInfoPT;               /*(14)  Print Time Imaging metrics*/
  168.     TPrXInfo prXInfo;               /*(16)  Print-time (expanded) Print info record.*/
  169.     TPrJob prJob;                   /*(20) The Print Job request (82)  Total of the above; 120-82 = 38 bytes needed to fill 120*/
  170.     short printX[19];               /*Spare to fill to 120 bytes!*/
  171. };
  172.  
  173. typedef struct TPrint TPrint;
  174. typedef TPrint *TPPrint, **THPrint;
  175.  
  176. /* The universal 120 byte printing record */
  177. struct TPrStatus {
  178.     short iTotPages;                /*Total pages in Print File.*/
  179.     short iCurPage;                 /*Current page number*/
  180.     short iTotCopies;               /*Total copies requested*/
  181.     short iCurCopy;                 /*Current copy number*/
  182.     short iTotBands;                /*Total bands per page.*/
  183.     short iCurBand;                 /*Current band number*/
  184.     Boolean fPgDirty;               /*True if current page has been written to.*/
  185.     Boolean fImaging;               /*Set while in band's DrawPic call.*/
  186.     THPrint hPrint;                 /*Handle to the active Printer record*/
  187.     TPPrPort pPrPort;               /*Ptr to the active PrPort*/
  188.     PicHandle hPic;                 /*Handle to the active Picture*/
  189. };
  190.  
  191. typedef struct TPrStatus TPrStatus;
  192. typedef TPrStatus *TPPrStatus;
  193.  
  194. /* Print Status: Print information during printing. */
  195. struct TPfPgDir {
  196.     short iPages;
  197.     long iPgPos[129];               /*ARRAY [0..iPfMaxPgs] OF LONGINT*/
  198. };
  199.  
  200. typedef struct TPfPgDir TPfPgDir;
  201. typedef TPfPgDir *TPPfPgDir, **THPfPgDir;
  202.  
  203. /* PicFile = a TPfHeader followed by n QuickDraw Pics (whose PicSize is invalid!) */
  204. struct TPrDlg {
  205.     DialogRecord Dlg;               /*The Dialog window*/
  206.     ModalFilterProcPtr pFltrProc;   /*The Filter Proc.*/
  207.     PItemProcPtr pItemProc;         /*The Item evaluating proc.*/
  208.     THPrint hPrintUsr;              /*The user's print record.*/
  209.     Boolean fDoIt;
  210.     Boolean fDone;
  211.     long lUser1;                    /*Four longs for user's to hang global data.*/
  212.     long lUser2;                    /*...Plus more stuff needed by the particular printing dialog.*/
  213.     long lUser3;
  214.     long lUser4;
  215. };
  216.  
  217. typedef struct TPrDlg TPrDlg;
  218. typedef TPrDlg *TPPrDlg;
  219.  
  220.  
  221. typedef pascal TPPrDlg (*PDlgInitProcPtr)(THPrint hPrint);
  222.  
  223. /* This is the Printing Dialog Record. Only used by folks appending their own dialogs.
  224. Print Dialog: The Dialog Stream object. */
  225.  
  226.  
  227.  
  228. struct TGnlData {
  229.     short iOpCode;
  230.     short iError;
  231.     long lReserved;                 /*more fields here depending on call*/
  232. };
  233.  
  234. typedef struct TGnlData TGnlData;
  235.  
  236. struct TRslRg {
  237.     short iMin;
  238.     short iMax;
  239. };
  240.  
  241. typedef struct TRslRg TRslRg;
  242.  
  243. struct TRslRec {
  244.     short iXRsl;
  245.     short iYRsl;
  246. };
  247.  
  248. typedef struct TRslRec TRslRec;
  249.  
  250. struct TGetRslBlk {
  251.     short iOpCode;
  252.     short iError;
  253.     long lReserved;
  254.     short iRgType;
  255.     TRslRg xRslRg;
  256.     TRslRg yRslRg;
  257.     short iRslRecCnt;
  258.     TRslRec rgRslRec[27];
  259. };
  260.  
  261. typedef struct TGetRslBlk TGetRslBlk;
  262.  
  263. struct TSetRslBlk {
  264.     short iOpCode;
  265.     short iError;
  266.     long lReserved;
  267.     THPrint hPrint;
  268.     short iXRsl;
  269.     short iYRsl;
  270. };
  271.  
  272. typedef struct TSetRslBlk TSetRslBlk;
  273.  
  274. struct TDftBitsBlk {
  275.     short iOpCode;
  276.     short iError;
  277.     long lReserved;
  278.     THPrint hPrint;
  279. };
  280.  
  281. typedef struct TDftBitsBlk TDftBitsBlk;
  282.  
  283. struct TGetRotnBlk {
  284.     short iOpCode;
  285.     short iError;
  286.     long lReserved;
  287.     THPrint hPrint;
  288.     Boolean fLandscape;
  289.     char bXtra;
  290. };
  291.  
  292. typedef struct TGetRotnBlk TGetRotnBlk;
  293.  
  294.  
  295. #ifdef __cplusplus
  296. extern "C" {
  297. #endif
  298. pascal void PrPurge(void); 
  299. pascal void PrNoPurge(void); 
  300. pascal void PrOpen(void); 
  301. pascal void PrClose(void); 
  302. pascal void PrintDefault(THPrint hPrint); 
  303. pascal Boolean PrValidate(THPrint hPrint); 
  304. pascal Boolean PrStlDialog(THPrint hPrint); 
  305. pascal Boolean PrJobDialog(THPrint hPrint); 
  306. pascal TPPrDlg PrStlInit(THPrint hPrint); 
  307. pascal TPPrDlg PrJobInit(THPrint hPrint); 
  308. pascal void PrJobMerge(THPrint hPrintSrc,THPrint hPrintDst); 
  309. pascal Boolean PrDlgMain(THPrint hPrint,PDlgInitProcPtr pDlgInit); 
  310. pascal TPPrPort PrOpenDoc(THPrint hPrint,TPPrPort pPrPort,Ptr pIOBuf); 
  311. pascal void PrCloseDoc(TPPrPort pPrPort); 
  312. pascal void PrOpenPage(TPPrPort pPrPort,TPRect pPageFrame); 
  313. pascal void PrClosePage(TPPrPort pPrPort); 
  314. pascal void PrPicFile(THPrint hPrint,TPPrPort pPrPort,Ptr pIOBuf,Ptr pDevBuf,
  315.     TPrStatus *prStatus); 
  316. pascal short PrError(void); 
  317. pascal void PrSetError(short iErr); 
  318. pascal void PrGeneral(Ptr pData); 
  319. pascal void PrDrvrOpen(void); 
  320. pascal void PrDrvrClose(void); 
  321. pascal void PrCtlCall(short iWhichCtl,long lParam1,long lParam2,long lParam3); 
  322. pascal Handle PrDrvrDCE(void); 
  323. pascal short PrDrvrVers(void); 
  324. #ifdef __cplusplus
  325. }
  326. #endif
  327.  
  328. #endif
  329.